<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:t="http://myfaces.apache.org/tomahawk"
                template="/pages/crud_template.xhtml">
                
     <ui:param name="crudBean" value="#{clienteBean}" />
     
     <ui:define name="saveStateObjectsDefined">
		<t:saveState value="#{crudBean.enderecoAdicionar}" />
		<t:saveState value="#{crudBean.listaAdicionarEndereco}" />
		<t:saveState value="#{crudBean.telefoneAdicionar}" />
		<t:saveState value="#{crudBean.listaAdicionarTelefone}" />
		<t:saveState value="#{crudBean.estado}" />
		<t:saveState value="#{crudBean.estadoTelefone}" />
	 </ui:define>
     
     <ui:define name="requiredFieldsMessage">
		<h:outputText value="#{bundle.todosCamposObrigatorios}" rendered="#{crudBean.updating}"/>
	</ui:define>
	
	<ui:define name="content">
		<!-- Painel de Pesquisa -->
		<h:panelGroup id="panelGroupDePesquisa" rendered="#{crudBean.searching}">
			<f:subview id="viewBusca">
				<table>
					<tr>
						<td class="tdCor" width="120px;"><h:outputText value="Tipo de Pessoa"/></td>
						<td class="tdBranco">
							<div style="width: 200px;">
								<h:selectOneRadio value="#{crudBean.searchObject.tipoPessoa}">
								   <f:selectItem itemValue="F" itemLabel="Física"/>
								   <f:selectItem itemValue="J" itemLabel="Jurídica"/>
								   <a4j:support reRender="formulario" event="onchange">
								 	  	<f:setPropertyActionListener value="" target="#{crudBean.searchObject.cpf}"/>
								 	  	<f:setPropertyActionListener value="" target="#{crudBean.searchObject.cnpj}"/>
								   </a4j:support>
								</h:selectOneRadio>
							</div>
						</td>
					</tr>
				</table>
				<h:panelGroup id="panelPesquisaCPF" rendered="#{crudBean.searchObject.tipoPessoa.valor == 'F'}">
					<table>
						<tr>
							<td class="tdCor" width="120px;"><h:outputText value="CPF"/></td>
							<td class="tdBranco">
								<h:inputText value="#{crudBean.searchObject.cpf}" styleClass="baseField" size="20" maxlength="14" onkeypress="return formataCPF(event, this);" onblur="completaCPF(this);"/>
							</td>
						</tr>
					</table>
				</h:panelGroup>
				<h:panelGroup id="panelPesquisaCNPJ" rendered="#{crudBean.searchObject.tipoPessoa.valor == 'J'}">
					<table>
						<tr>
							<td class="tdCor" width="120px;"><h:outputText value="CNPJ"/></td>
							<td class="tdBranco">
								<h:inputText value="#{crudBean.searchObject.cnpj}" styleClass="baseField" size="20" maxlength="18" onkeypress="return formataCNPJ(event, this);" onblur="completaCNPJ(this);"/>
							</td>
						</tr>
					</table>
				</h:panelGroup>
				<table>
					<tr>
						<td class="tdCor" width="120px;"><h:outputText value="Nome"/></td>
						<td class="tdBranco">
							<h:inputText value="#{crudBean.searchObject.nome}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
			
			<!-- Painel de Edição -->
		<h:panelGroup id="panelGroupDeEdicao" rendered="#{crudBean.updating}">
			<f:subview id="viewEdicao">
				<rich:tabPanel switchType="client">
					 <rich:tab label="Dados Gerais">
						<table>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Tipo de Pessoa *"/></td>
								<td class="tdBranco">
									<div style="width: 200px;">
										<h:selectOneRadio value="#{crudBean.entity.tipoPessoa}">
										   <f:selectItem itemValue="F" itemLabel="Física"/>
										   <f:selectItem itemValue="J" itemLabel="Jurídica"/>
										   <a4j:support reRender="formulario" event="onchange">
										 	  	<f:setPropertyActionListener value="" target="#{crudBean.entity.cpf}"/>
										 	  	<f:setPropertyActionListener value="" target="#{crudBean.searchObject.cnpj}"/>
										   </a4j:support>
										</h:selectOneRadio>
									</div>
								</td>
							</tr>
						</table>
						<h:panelGroup id="panelUpdateCPF" rendered="#{crudBean.entity.tipoPessoa.valor == 'F'}">
							<table>
								<tr>
									<td class="tdCor" width="120px;"><h:outputText value="CPF *"/></td>
									<td class="tdBranco">
										<h:inputText value="#{crudBean.entity.cpf}" styleClass="baseField" size="20" maxlength="14" onkeypress="return formataCPF(event, this);" onblur="completaCPF(this);"/>
									</td>
								</tr>
							</table>
						</h:panelGroup>
						<h:panelGroup id="panelUpdateCNPJ" rendered="#{crudBean.entity.tipoPessoa.valor == 'J'}">
							<table>
								<tr>
									<td class="tdCor" width="120px;"><h:outputText value="CNPJ *"/></td>
									<td class="tdBranco">
										<h:inputText value="#{crudBean.entity.cnpj}" styleClass="baseField" size="20" maxlength="18" onkeypress="return formataCNPJ(event, this);" onblur="completaCNPJ(this);"/>
									</td>
								</tr>
								<tr>
									<td class="tdCor"><h:outputText value="Inscrição Estadual"/></td>
									<td class="tdBranco">
										<h:inputText value="#{crudBean.entity.clninsest}" styleClass="baseField" size="25" maxlength="20" onblur="upperCase(this)"/>
									</td>
								</tr>
							</table>
						</h:panelGroup>
						<table>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Nome *"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.entity.nome}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor"><h:outputText value="Contato"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.entity.contato}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor"><h:outputText value="Email"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.entity.email}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
						</table>
					</rich:tab>
					
					<rich:tab label="Endereço">
						<table>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Descrição"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.descricao}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="CEP"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.cep}" styleClass="baseField" size="15" maxlength="10" onkeypress="return formataCEP(event,this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Logradouro"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.logradouro}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Número"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.numero}" styleClass="baseField" size="8" maxlength="5" onkeypress="return soNumero(event,this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Complemento"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.complemento}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Bairro"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.bairro}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Cidade"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.cidade}" styleClass="baseField" size="70" maxlength="100" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="UF"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.enderecoAdicionar.uf}" styleClass="baseField" size="5" maxlength="2" onblur="upperCase(this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" colspan="2">
									<a4j:commandButton value="Adicionar" actionListener="#{crudBean.adicionarEndereco}" reRender="panelGroupDeEdicao" rendered="#{crudBean.estado == ''}"/>
									<a4j:commandButton value="Alterar" actionListener="#{crudBean.alterarEndereco}" reRender="panelGroupDeEdicao" rendered="#{crudBean.estado == 'alterarEndereco'}"/>
								</td>
							</tr>
						</table>
						
						<br />
						
						<h:panelGroup id="panelAdicionarEndereco">
							<f:subview id="viewAdicionarEndereco">
								<rich:dataTable id="tblAdicionarEndereco" value="#{crudBean.listaAdicionarEndereco}" binding="#{crudBean.tblAdicionarEndereco}" var="rst" style="width: 100%;" rowClasses="par,impar">
									<f:facet name="header">
										<rich:columnGroup>
											<rich:column style="text-align:left">
												<h:outputText value="Descrição"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="CEP"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="Logradouro"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="Número"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="Complemento"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="Bairro"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="Cidade"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="UF"/>
											</rich:column>
											<rich:column style="text-align:center">
											</rich:column>
											<rich:column style="text-align:center">
											</rich:column>
										</rich:columnGroup>
									</f:facet>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.descricao}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.cep}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.logradouro}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.numero}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.complemento}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.bairro}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.cidade}" />
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="#{rst.uf}" />
									</rich:column>
									<rich:column style="text-align:center" rendered="#{rst.flagAtivo == 'SIM'}">
										<a4j:commandButton image="/imagens/alterar.png" style="border:white;" title="ALTERAR" actionListener="#{crudBean.preparaAlterarEndereco}" reRender="formulario, panelTitle"/>
									</rich:column>
									<rich:column style="text-align:center" rendered="#{rst.flagAtivo == 'SIM'}">
										<a4j:commandButton image="/imagens/inativar.png" style="border:white;" title="EXCLUIR" actionListener="#{crudBean.removerEndereco}" reRender="panelGroupDeEdicao" onclick="if (!confirm('Deseja mesmo inativar este endereço?')) return false;"/>
									</rich:column>
								</rich:dataTable>
							</f:subview>
						</h:panelGroup>
					</rich:tab>
					
					<rich:tab label="Telefone/Celular">
						<table>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Tipo"/></td>
								<td class="tdBranco">
									<h:selectOneMenu value="#{crudBean.telefoneAdicionar.tipo}">
										<f:selectItem itemValue="" itemLabel=""/>
										<f:selectItem itemValue="2" itemLabel="CELULAR"/>
										<f:selectItem itemValue="1" itemLabel="COMERCIAL"/>
										<f:selectItem itemValue="4" itemLabel="FAX"/>
										<f:selectItem itemValue="3" itemLabel="RESIDENCIAL"/>
									</h:selectOneMenu>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;"><h:outputText value="Número"/></td>
								<td class="tdBranco">
									<h:inputText value="#{crudBean.telefoneAdicionar.ddd}" styleClass="baseField" size="4" maxlength="2" onkeypress="return soNumero(event,this)"/>
									-
									<h:inputText value="#{crudBean.telefoneAdicionar.numero}" styleClass="baseField" size="10" maxlength="9" onkeypress="return formataTelefone(event,this)"/>
								</td>
							</tr>
							<tr>
								<td class="tdCor" width="120px;">
									<a4j:commandButton value="Adicionar" actionListener="#{crudBean.adicionarTelefone}" reRender="panelGroupDeEdicao" rendered="#{crudBean.estadoTelefone == ''}"/>
									<a4j:commandButton value="Alterar" actionListener="#{crudBean.alterarTelefone}" reRender="panelGroupDeEdicao" rendered="#{crudBean.estadoTelefone == 'alterarTelefone'}"/>
								</td>
							</tr>
						</table>
						
						<br />
						
						<h:panelGroup id="panelAdicionarTelefone">
							<f:subview id="viewAdicionarTelefone">
								<rich:dataTable id="tblAdicionarTelefone" value="#{crudBean.listaAdicionarTelefone}" binding="#{crudBean.tblAdicionarTelefone}" var="rst" style="width: 100%;" rowClasses="par,impar">
									<f:facet name="header">
										<rich:columnGroup>
											<rich:column style="text-align:left">
												<h:outputText value="Tipo"/>
											</rich:column>
											<rich:column style="text-align:left">
												<h:outputText value="Número"/>
											</rich:column>
											<rich:column style="text-align:center">
											</rich:column>
											<rich:column style="text-align:center">
											</rich:column>
										</rich:columnGroup>
									</f:facet>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="CELULAR" rendered="#{rst.tipo.valor == 2}"/>
										<h:outputText value="COMERCIAL" rendered="#{rst.tipo.valor == 1}"/>
										<h:outputText value="FAX" rendered="#{rst.tipo.valor == 4}"/>
										<h:outputText value="RESIDENCIAL" rendered="#{rst.tipo.valor == 3}"/>
									</rich:column>
									<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
										<h:outputText value="(#{rst.ddd}) #{rst.numero}" />
									</rich:column>
									<rich:column style="text-align:center" rendered="#{rst.flagAtivo == 'SIM'}">
										<a4j:commandButton image="/imagens/alterar.png" style="border:white;" title="ALTERAR" actionListener="#{crudBean.preparaAlterarTelefone}" reRender="formulario, panelTitle"/>
									</rich:column>
									<rich:column style="text-align:center" rendered="#{rst.flagAtivo == 'SIM'}">
										<a4j:commandButton image="/imagens/inativar.png" style="border:white;" title="EXCLUIR" actionListener="#{crudBean.removerTelefone}" reRender="panelGroupDeEdicao" onclick="if (!confirm('Deseja mesmo inativar este telefone?')) return false;"/>
									</rich:column>
								</rich:dataTable>
							</f:subview>
						</h:panelGroup>
					</rich:tab>
				</rich:tabPanel>
			</f:subview>
		</h:panelGroup>
	</ui:define>
	
	<ui:define name="list">
	
		<rich:modalPanel id="panelTelefoneList" width="500" height="200" style="overflow: auto">
			<f:facet name="header">
	            <h:panelGroup>
	                <h:outputText value="Telefones"></h:outputText>
	            </h:panelGroup>
	        </f:facet>
	        
	        <rich:dataTable id="tblPesquisarTelefone" value="#{crudBean.listaPesquisarTelefone}" binding="#{crudBean.tblPesquisarTelefone}" var="rst" style="width: 100%;" rowClasses="par,impar">
	        	<f:facet name="header">
					<rich:columnGroup>
						<rich:column style="text-align:left">
							<h:outputText value="Tipo"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="Número"/>
						</rich:column>
					</rich:columnGroup>
				</f:facet>
	        	
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="CELULAR" rendered="#{rst.tipo.valor == 2}"/>
					<h:outputText value="COMERCIAL" rendered="#{rst.tipo.valor == 1}"/>
					<h:outputText value="FAX" rendered="#{rst.tipo.valor == 4}"/>
					<h:outputText value="RESIDENCIAL" rendered="#{rst.tipo.valor == 3}"/>
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="(#{rst.ddd}) #{rst.numero}" />
				</rich:column>
	        </rich:dataTable>
	        
	        <br />
	        
	        <a4j:commandButton value="Fechar" ajaxSingle="true" oncomplete="#{rich:component('panelTelefoneList')}.hide()" reRender="formulario">
           		<f:setPropertyActionListener value="" target="#{crudBean.listaPesquisarTelefone}"/>
           	</a4j:commandButton>
	        
		</rich:modalPanel>
		
		<rich:modalPanel id="panelEnderecoList" width="850" height="400" style="overflow: auto">
			<f:facet name="header">
	            <h:panelGroup>
	                <h:outputText value="Endereço"></h:outputText>
	            </h:panelGroup>
	        </f:facet>
	        
	        <rich:dataTable id="tblPesquisarEndereco" value="#{crudBean.listaPesquisarEndereco}" binding="#{crudBean.tblPesquisarEndereco}" var="rst" style="width: 100%;" rowClasses="par,impar">
	        	<f:facet name="header">
					<rich:columnGroup>
						<rich:column style="text-align:left">
							<h:outputText value="Descrição"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="CEP"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="Logradouro"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="Número"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="Complemento"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="Bairro"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="Cidade"/>
						</rich:column>
						<rich:column style="text-align:left">
							<h:outputText value="UF"/>
						</rich:column>
					</rich:columnGroup>
				</f:facet>
	        	
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.descricao}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.cep}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.logradouro}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.numero}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.complemento}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.bairro}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.cidade}" />
				</rich:column>
	        	<rich:column style="text-align:left" rendered="#{rst.flagAtivo == 'SIM'}">
					<h:outputText value="#{rst.uf}" />
				</rich:column>
	        </rich:dataTable>
	        
	        <br />
	        
	        <a4j:commandButton value="Fechar" ajaxSingle="true" oncomplete="#{rich:component('panelEnderecoList')}.hide()" reRender="formulario">
           		<f:setPropertyActionListener value="" target="#{crudBean.listaPesquisarEndereco}"/>
           	</a4j:commandButton>
	        
		</rich:modalPanel>
	
	
		<f:subview id="viewListagem" rendered="#{crudBean.searching}">
			<rich:dataTable id="tblData" value="#{crudBean.searchResult}" binding="#{crudBean.tblData}" var="rst" style="width: 100%;" rowClasses="par,impar">
				<f:facet name="header">
					<rich:columnGroup>
						<rich:column style="text-align: left;">
							<h:outputText value="Nome"/>
						</rich:column>
						<rich:column style="text-align: left;">
							<h:outputText value="Tipo de Pessoa"/>
						</rich:column>
						<rich:column style="text-align: left;">
							<h:outputText value="CPF/CNPJ"/>
						</rich:column>
						<rich:column style="text-align: left;">
							<h:outputText value="Contato"/>
						</rich:column>
						<rich:column style="text-align: left;">
							<h:outputText value="Email"/>
						</rich:column>
						<rich:column style="text-align: center;">
						</rich:column>
						<rich:column style="text-align: center;">
						</rich:column>
						<rich:column style="text-align: center;">
						</rich:column>
						<rich:column style="text-align: center;">
						</rich:column>
					</rich:columnGroup>
				</f:facet>
				
				<rich:column style="text-align: left;">
					<h:outputText value="#{rst.nome}"/>
				</rich:column>
				<rich:column style="text-align: left;">
					<h:outputText value="FÍSICA" rendered="#{rst.tipoPessoa.valor == 'F'}"/>
					<h:outputText value="JURÍDICA" rendered="#{rst.tipoPessoa.valor == 'J'}"/>
				</rich:column>
				<rich:column style="text-align: left;">
					<h:outputText value="#{rst.cpf}"/>
					<h:outputText value="#{rst.cnpj}"/>
				</rich:column>
				<rich:column style="text-align: left;">
					<h:outputText value="#{rst.contato}"/>
				</rich:column>
				<rich:column style="text-align: left;">
					<h:outputText value="#{rst.email}"/>
				</rich:column>
				<rich:column style="text-align: center;">
					<a4j:commandButton image="/imagens/telefone.png" style="border:white;" title="TELEFONE" ajaxSingle="true" oncomplete="#{rich:component('panelTelefoneList')}.show()" reRender="formulario">
						<f:setPropertyActionListener value="#{rst.listaTelefone}" target="#{crudBean.listaPesquisarTelefone}"/>
					</a4j:commandButton>
				</rich:column>
				<rich:column style="text-align: center;">
					<a4j:commandButton image="/imagens/endereco.png" style="border:white;" title="ENDEREÇO" ajaxSingle="true" oncomplete="#{rich:component('panelEnderecoList')}.show()" reRender="formulario">
						<f:setPropertyActionListener value="#{rst.listaEndereco}" target="#{crudBean.listaPesquisarEndereco}"/>
					</a4j:commandButton>
				</rich:column>
				<rich:column style="text-align: center;">
					<a4j:commandButton image="/imagens/alterar.png" style="border:white;" title="ALTERAR" actionListener="#{crudBean.preparaAlterar}" reRender="formulario, panelTitle"/>
				</rich:column>
				<rich:column style="text-align: center;">
					<a4j:commandButton image="/imagens/inativar.png" style="border:white;" title="CANCELAR" actionListener="#{crudBean.cancelarCliente}" reRender="formulario" onclick="if (!confirm('Deseja mesmo inativar este cliente?')) return false"/>
				</rich:column>
			</rich:dataTable>
		</f:subview>
	</ui:define>
                
</ui:composition>